package org.umss.fixturebuilder.resources;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import org.umss.fixturebuilder.controller.GameController;

/**
 *
 * @author Daniela Meneses
 */
@Path("/game")
public class GameResource {

    @Path("/result/{id}")
    @POST
    public Response setResult(@PathParam("id") String id, @QueryParam("local_score") int localScore, @QueryParam("visitor_score") int visitorScore) {

        boolean success = GameController.setGameScore(id, localScore, visitorScore);
        return success ? Response.status(Response.Status.OK).build()
                : Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
    }

}
